package com.ethink.platform.controller.warehouse;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ethink.platform.controller.order.info.ExportInfo;
import com.ethink.platform.manager.ExportManager;
import com.ethink.warehouse.api.response.MateInventoryDetailOrderQueryResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.ethink.framework.common.web.BaseController;
import com.ethink.framework.common.web.response.CommonResponse;
import com.ethink.warehouse.api.MateInventoryDetailOrderFacade;
import com.ethink.warehouse.api.request.MateInventoryDetailOrderQueryRequest;

/**
 * 入库/出库明细单 Controller
 *
 * @author default
 * @date 2022-12-17
 */
@Tag(name = "MateInventoryDetailOrderController", description = "入库/出库明细单 Controller")
@RestController
@Slf4j
@RequestMapping("platform-server/v1/warehouse-service")
public class MateInventoryDetailOrderController extends BaseController {

    @Autowired
    private MateInventoryDetailOrderFacade mateInventoryDetailOrderFacade;

    @Autowired
    private ExportManager exportManager;

    @Operation(summary = "分页查询")
    @GetMapping("/mateInventoryDetailOrder/query")
    public CommonResponse<List<MateInventoryDetailOrderQueryResponse>> queryMateInventoryDetailOrder(MateInventoryDetailOrderQueryRequest request) {
        Page<MateInventoryDetailOrderQueryResponse> response = mateInventoryDetailOrderFacade.queryMateInventoryDetailOrder(request);
        return succeedWithPage(response);
    }

    @Operation(summary = "出/入库单导出Excel")
    @GetMapping("/mateInventoryDetailOrder/export")
    public CommonResponse<ExportInfo> exportMateInventoryDetailOrder(MateInventoryDetailOrderQueryRequest request) {
        return succeedWith(exportManager.exportMateInventoryDetailOrder(request));
    }

}